package cn.com.epicc.wap.epe.product.service.impl;

import cn.com.epicc.wap.epe.common.util.CommonUtil;
import cn.com.epicc.wap.epe.product.constants.ProductStatus;
import cn.com.epicc.wap.epe.product.constants.ProductType;
import cn.com.epicc.wap.epe.product.dao.PrpdProductDao;
import cn.com.epicc.wap.epe.product.entity.PrpdProduct;
import cn.com.epicc.wap.epe.product.service.ProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Description: 产品服务实现
 * Author: lishangmin
 * Created: 2018-06-11 14:13
 */
@Slf4j
@Service
public class ProductServiceImpl implements ProductService{

    @Autowired
    PrpdProductDao prpdProductDao;

    /**
     * 添加一个产品
     */
    @Override
    public PrpdProduct add() {
        PrpdProduct product = new PrpdProduct();
        product.setProductCode(CommonUtil.getUUID());
        product.setProductName("保险1");
        product.setUrl("http://www.baidu.com");
        product.setStatus(ProductStatus.INIT.get());
        product.setType(ProductType.TOURISM.get());
        product.setVersion(1);
        product.setUpdateTime(new Date());
        product.setInsertTime(new Date());
        prpdProductDao.insert(product);
        log.info("{}",product.toString());
        return product;
    }

}
